import 'package:flutter/material.dart';
import 'ChildCase.dart';

class ParentCase extends StatefulWidget {
  const ParentCase({Key? key}) : super(key: key);
  // 一个向外
  @override
  _ParentCaseState createState() => _ParentCaseState();
}

class _ParentCaseState extends State<ParentCase> {
  // 向内
  int count = 10; //

  void updateValue(int value) {
    setState(() {
      count = value; // 响应式的
    });
    //  count = value; // 非响应式的
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.center, // 交叉轴对齐
      children: [
        const Text(
          "父组件标题",
          style: TextStyle(fontSize: 30),
        ),
        ChildCase(
          count: count,
          updateCallBack: updateValue,
        )
      ],
    );
  }
}